package com.hf.db;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class TestDriver {
    public static void main(String[] args) {
        test02(7934);
        System.out.println("===============================");
        test01();
    }

    public static void test02(int empno) {
        //创建对象
        DbProvider dbProvider = new DbProvider();
        //调用增删改方法
        int i = dbProvider.idu("delete from emp3 where empno = '"+empno+"'", empno);
        //int i = dbProvider.idu("delete from emp3 where empno = ? ", empno);
        System.out.println("增删改"+i);
    }

    public static void test01(){
        //创建对象
        DbProvider dbProvider = new DbProvider();
        //创建List+Map对象，将查询结果赋给它
        //调用查询方法
        List<Map<String,Object>> list =  dbProvider.requryListMap("select * from emp3");
        //遍历List+Map集合
        for (Map<String,Object> map : list){
            Set<String> setKeys = map.keySet();
            for (String str : setKeys){
                System.out.print("    "+map.get(str));
            }
            System.out.println();
        }
    }

}
